/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainFrame.java
 * Created on Mar 3, 2009, 1:14:05 PM
 */
package rehab.host.gui;

import rehab.host.global.SensorTypes;
import rehab.host.global.PacketTypes;
import rehab.host.db.ClassDB;
import rehab.host.conn.*;
import java.awt.*;
import java.awt.Graphics;
import java.sql.*;
import java.util.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.*;
import java.lang.Double;
import java.io.*;
import javax.swing.border.TitledBorder;
import rehab.host.global.SingleSPOT;
import rehab.host.spotfinder.BaseStation;

/**
 *
 * @author shahsant
 */
public class MainFrame extends javax.swing.JFrame implements SensorTypes, PacketTypes {

    private final int MAXSPOTS = 10;
    private final int MAXSENSORS = 14;
    public static MainFrame telemetryFrame;
    public GraphView[][] graphView = new GraphView[MAXSPOTS][MAXSENSORS];
    public final GraphView[] gview = new GraphView[MAXSENSORS];
    //private static AccelerometerListener accListener = null;
    private static Listener[] listener = null;
    private JPanel[] axisView = new JPanel[MAXSENSORS];
    private boolean fixedData = false;
    private boolean clearedData = true;
    private boolean sendData = false;
    private ResultSet rs = null;
    public DefaultTableModel model = null;
    public GCanvas[][] canvas = new GCanvas[MAXSPOTS][MAXSENSORS];
    public Graphics g;
    public Graphics2D g2D;
    public Container container;
    private JScrollPane[][] jScrollPane = new JScrollPane[MAXSPOTS][MAXSENSORS];
    private JLayeredPane[][] jLayeredPane = new JLayeredPane[MAXSPOTS][MAXSENSORS];
    private boolean UserVerfied = false;
    private boolean admin = false;
    private File file = null;
    public Container cont;
    
    public JCheckBox[] jCheckBoxArray = new JCheckBox[MAXSPOTS];
    private boolean [] isSelected = new boolean[MAXSPOTS];
    public JTextField[] jTextFieldArray = new JTextField[MAXSPOTS];
    public JList sensorConfigList;
    public JList spotList;
    public DefaultListModel listModel;
    public SensorDrop[] sd = new SensorDrop[MAXSPOTS];
    public SensorDrop sdT;// = new SensorDrop();
    public int currentSPOT = 0;
    public int numberOfSpots = 0;
    public int numSpotsSelected = 0;
    public boolean doneConfiguringSPOTS = false;
    public JPanel[] graphPanelSPOT = new JPanel[MAXSPOTS];
    public JPanel[][] graphPanelSensors = new JPanel[MAXSPOTS][MAXSENSORS];
    public JPanel[][] graphYaxisPanelSensors = new JPanel[MAXSPOTS][MAXSENSORS];
    public Vector[] spotReturnType = new Vector[MAXSPOTS];
    private static String frameTitle = "Rehab Application";
    private String rootUser = "root";
    public BaseStation myBaseStation;
    private JRadioButton[] patientResult = new JRadioButton[20];
    private ButtonGroup bGroup = new ButtonGroup();
    private ResultSet rset = null;
    private Vector SPOTLIST = null;


    public MainFrame(JPanel jPanel1) {

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {

        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (UnsupportedLookAndFeelException ex) {
            System.out.println("Unsupported Look and Feel Excep " + ex.getMessage());
            ex.printStackTrace();

        } catch (IllegalAccessException ex) {
            System.out.println("Illegal Access Exception " + ex.getMessage());
            ex.printStackTrace();
        } catch (ClassNotFoundException ex) {
            System.out.println("Class not found " + ex.getMessage());
            ex.printStackTrace();
        } catch (InstantiationException ex) {
            System.out.println("Instantiation Exception " + ex.getMessage());
            ex.printStackTrace();
        }
        MainFrame.frameGraph();
    }

    /**
     * Connect this window with a graph display and a file.
     */
    private static MainFrame frameGraph() {

        telemetryFrame = new MainFrame();
        telemetryFrame.setTitle(frameTitle);
        telemetryFrame.setMainDisplayPanel();
        telemetryFrame.setLocation(200, 150);
        telemetryFrame.pack();
        telemetryFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
        telemetryFrame.setVisible(true);
        //myBaseStation = new BaseStation(this);
        telemetryFrame.setOptionsAccess();

        // String str = telemetryFrame.getTitle();


        // uncomment for multiple windowns
//        if (!checkTitle(str)) {
//            int i = 1;
//            while (true) {
//                if (checkTitle(str + "-" + i)) {
//                    telemetryFrame.setTitle(str + "-" + i);
//                    break;
//                } else {
//                    i++;
//                }
//            }
//        }
//        windows.add(telemetryFrame);
//        numWindows++;
        return telemetryFrame;
    }

    private void setMainDisplayPanel() {
        jPanelMainPanel.removeAll();
        jPanelMainPanel.add(jPanelLoginPanel);
    }

    private void setMainDisplayPanel(JPanel panel) {
        jPanelMainPanel.removeAll();
        jPanelMainPanel.add(panel, BorderLayout.CENTER);
        jPanelMainPanel.validate();
        jPanelMainPanel.repaint();
    }

    private void setGraphViewSensorType(int Sensor, GraphView gv){
        gv.sensorType = Sensor;
    }
    /**
     * For split view - over loading method Graph View
     *
     */
    private void setGraphView(GraphView gv, int spot, int sensor) {

//        gv = new GraphView();
        System.out.println("MainFrame: graphview for Spot: " +spot+ " and Sensor : "+sensor+" created!");
        final Integer spot1 = new Integer(spot);
        final Integer sensor1 = new Integer(sensor);

        setGraphViewSensorType(sensor, gv);         // to set the legend
        
        jScrollPane[spot][sensor] = new JScrollPane();
        jLayeredPane[spot][sensor] = new JLayeredPane();
        canvas[spot][sensor] = new GCanvas();

        jLayeredPane[spot][sensor].setSize(graphPanelSensors[spot][sensor].getSize());
        jLayeredPane[spot][sensor].setLayout(new OverlayLayout(jLayeredPane[spot][sensor]));

        jScrollPane[spot][sensor].setOpaque(true);
        jScrollPane[spot][sensor].setSize(jLayeredPane[spot][sensor].getSize());
        jScrollPane[spot][sensor].setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane[spot][sensor].setAutoscrolls(true);
        canvas[spot][sensor].setOpaque(false);
        canvas[spot][sensor].setSize(jLayeredPane[spot][sensor].getSize());

        jLayeredPane[spot][sensor].add(jScrollPane[spot][sensor], new Integer(-1));
        jLayeredPane[spot][sensor].add(canvas[spot][sensor], new Integer(0));
        
        jScrollPane[spot][sensor].setViewportView(gv);
        gv.setViewport(jScrollPane[spot][sensor].getViewport());
        
        jScrollPane[spot][sensor].addMouseListener(new java.awt.event.MouseAdapter() {

            public void mouseClicked(java.awt.event.MouseEvent evt) {
                int i = evt.getClickCount();
                if(i == 2){
                    sensorPanelPopUp(evt, spot1, sensor1);
                }
                else
                    canvesPanelMouseClicked(evt, spot1, sensor1);
            }

            public void mouseReleased(java.awt.event.MouseEvent evt) {
                canvesPane1MouseDragged(evt, spot1, sensor1);
            }

        });

        jScrollPane[spot][sensor].addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {

            public void mouseDragged(java.awt.event.MouseEvent evt) {
            }
        });

        graphPanelSensors[spot][sensor].add(jLayeredPane[spot][sensor]);

//        gview[sensor]= new GraphView();
//        gview[sensor] = gv;
//        axisView[sensor] = new JPanel() {
//
//            public Dimension getPreferredSize(int sensor) {
//                return new Dimension(GraphView.AXIS_WIDTH, gview[sensor].getPreferredSize().height);
//            }
//
//            public void paintComponent(Graphics g, int sensor) {
//                super.paintComponent(g);
//                g.setColor(Color.BLACK);
//                gview[sensor].paintYaxis(g);
//            }
//        };
//        axisView[sensor].setBackground(Color.WHITE);
//
//        graphYaxisPanelSensors[spot][sensor].add(axisView[sensor]);
//
//
//
//
//        gv.setAxisPanel(axisView[sensor]);

    }

    public void setOptionsAccess() {

        telemetryFrame.jMenuData.setEnabled(UserVerfied);
        telemetryFrame.jMenuSensor.setEnabled(UserVerfied);
        telemetryFrame.jMenuItemNewRecord.setEnabled(UserVerfied);
        telemetryFrame.jMenuItemOpenPatientRecord.setEnabled(UserVerfied);
        telemetryFrame.jMenuItemCloseRecord.setEnabled(UserVerfied);
        telemetryFrame.jMenuItemNewTherapist.setEnabled(admin);
        telemetryFrame.jButtonStartLogging.setEnabled(UserVerfied);
        telemetryFrame.jButtonRetrieve.setEnabled(UserVerfied);
        telemetryFrame.jButtonSaveSession.setEnabled(UserVerfied);
        telemetryFrame.jButtonDiscardSession.setEnabled(UserVerfied);
        telemetryFrame.jMenuItemChangeUser.setText(UserVerfied ? "Switch User" : "Log On");
        jTextFieldLogin.setText("a");
        jPasswordFieldPassword.setText("p");
        jTextFieldPatientSearchName.setText("a");

    }

    private void verifyUser(String username, char[] password){

        UserVerfied = ClassDB.authUser(username, password);
        if(UserVerfied){
            System.out.println(username);
            if(username.equals(rootUser)){
                admin = true;
            }
            System.out.println(admin);
            jLabelLoginStatus.setText("User Verified, Thank you");
            setOptionsAccess();
            telemetryFrame.setTitle(frameTitle+ " - " +username);
        }
        else
            jLabelLoginStatus.setText("Invalid User name or Password, please try again");
    }

    public void setAdmin(boolean val){
        admin = val;
    }

    /**
     * File Chooser
     * @author Sunny
     */
    public void doSaveas() {
        JFileChooser chooser;
        if (file != null) {
            chooser = new JFileChooser(file.getParent());
        } else {
            chooser = new JFileChooser(System.getProperty("user.dir"));
        }
        int returnVal = chooser.showOpenDialog(this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            file = chooser.getSelectedFile();
            if (file.exists()) {
                int n = JOptionPane.showConfirmDialog(this, "The file: " + file.getName() +
                        " already exists. Do you wish to replace it?",
                        "File Already Exists",
                        JOptionPane.YES_NO_OPTION);
                if (n != JOptionPane.YES_OPTION) {
                    return;                             // cancel the Save As command
                }
            }
            setTitle(file.getName());
            doSave();
        }
    }

    /**
     * Save the current accelerometer data to the file associated with this window.
     */
    private void doSave() {
//        if (graphView.writeData(file)) {
//            jMenuItemSave.setEnabled(false);
//        }
    }

    /** Creates new form MainFrame */
    public MainFrame() {
        init();
    
    }

    public void init(){
        myBaseStation = new BaseStation(this);
        initComponents();
    }
    /**
     * initilize listener for spot
     * @param num = array index
     */
    /*private void initListener(int num) {
        if (listener[num] == null) {
            listener[num] = new Listener();
            listener[num].start();
        }
    }*/

    /**
     * Display the current connection status to a remote SPOT.
     * Called by the AccelerometerListener whenever the radio connection status changes.
     *
     * @param conn true if now connected to a remote SPOT
     * @param msg the String message to display, includes the
     */
    public void setConnectionStatus(boolean conn, String msg) {
        jLabelConnection.setText(msg);
//        blinkButton.setEnabled(conn);
//        pingButton.setEnabled(conn);
//        reconnButton.setEnabled(conn);
//        if (!fixedData) {
//            if (listener.is2GScale()) {
//                twoGRadioButton.setSelected(true);
//            } else {
//                sixGRadioButton.setSelected(true);
//            }
//            twoGRadioButton.setEnabled(conn);
//            sixGRadioButton.setEnabled(conn);
//            sendDataButton.setEnabled(conn);
//            clearButton.setEnabled(conn);
//            calibrateButton.setEnabled(conn);
//        }
    }

    private JList getListOfSpots(Vector v) {
        DefaultListModel model = new DefaultListModel();
        JList spotList = new JList(model);
        //model.addElement(v.get(i));
        return spotList;
    }

    private void addToReturnVector(byte sensorType, int spotNumber) {

        System.out.println("Main Frame: CurrentSPOT @ addToReturnVector"+spotNumber);
        spotReturnType[spotNumber].add(new Byte(sensorType));
    }

    /**
     * Displays the number of spots detected by basestation
     */
    private void displayFoundSpots() {

        jProgressBarSpotsDiscovered.setValue(0);
        jProgressBarSpotsDiscovered.setMaximum(3);
        jProgressBarSpotsDiscovered.setStringPainted(true);

        SPOTLIST = (Vector)myBaseStation.returnSPOTList();
        numberOfSpots = SPOTLIST.size();
        jProgressBarSpotsDiscovered.setValue(3);

        //adding spotlist name
        DefaultListModel spotListModel = new DefaultListModel();
        for (int i = 0; i < numberOfSpots; i++) {
            String spotName = "Spot " + (i + 1);
            spotListModel.addElement(spotName);
        }

        spotList = new JList(spotListModel);
        jPanelDeviceDiscovered.removeAll();
        jPanelDeviceDiscovered.setLayout(new FlowLayout(FlowLayout.LEADING, 30, 5));

        for (int i = 0; i < numberOfSpots; i++) {
            isSelected[i] = false;
            String jCheckBoxName = "SunSPOT # " + (i + 1);
            jCheckBoxArray[i] = new JCheckBox(jCheckBoxName);
            jTextFieldArray[i] = new JTextField("Set Name", 20);
            jPanelDeviceDiscovered.add(jCheckBoxArray[i]);
            jPanelDeviceDiscovered.add(jTextFieldArray[i]);
        }

        setMainDisplayPanel(jPanelNewSession);
    }

    /**
     * check if at least one check box is selected
     */
    private boolean checkSPOTBoxSelection() {

        for (int j = 0; j < numberOfSpots; j++) {
            if (jCheckBoxArray[j].isSelected()) {
                return true;
            }
        }
        jPanelDeviceDiscoveredWarning.setText("Please select at least one SPOT to configure");
        return false;
    }

    /**
     * Displays the drag and drop panel for sensor list selection for each SPOT
     */
    private void displaySensorDnD(int index) {

        for (int i = index; i < numberOfSpots; i++) {

            if (jCheckBoxArray[i].isSelected()) {
                isSelected[i]=true;
                sd[i] = new SensorDrop();
                jPanelDnD.removeAll();
                jPanelDnD.add(sd[i].getContent());
                setMainDisplayPanel(jPanelConfigureSensor);
                break;
            //setGraphDisplay(currentspot, sd[i]);
            } else {
                currentSPOT++;
                displaySensorDnD(currentSPOT);
            }
            if (i + 1 == numberOfSpots) {
                setMainDisplayPanel(jPanelMainGraphPanel);
            //System.out.println(spotReturnType[currentSPOT].elements());
            }
            break;
        }
    }

    /**
     * Displays the sensor configuration progress
     */
    private void displaySensorConfigProgress() {

        // setup spots display based on sensors selected
        setGraphDisplay();
        if ((currentSPOT + 1) == numberOfSpots) {           // if this is last spot that was selected, finish.
            doneConfiguringSPOTS = true;
            jPanelMainGraphSubPanel.revalidate();
            repaint();
            setMainDisplayPanel(jPanelMainGraphPanel);
//            for (int i = 0; i < numberOfSpots; i++){
//                for (int j = 0; j < spotReturnType.length; j++){
//                    System.out.println(spotReturnType[i].get(j));
//                }
//            }
        } else {                                          // else get sensor list configuration for that spot
            jButtonConfigureSensorStatusUpdateConfigureSpotNext.setText("Next");
            TitledBorder panelBorder = BorderFactory.createTitledBorder("Configure SPOT " + (currentSPOT + 2));
            jPanelConfigureSensor.setBorder(panelBorder);
            currentSPOT++;
            displaySensorDnD(currentSPOT);

        }
    }

    /**
     * Method to setup the mainGraphdisplay based on number of spots and sensor configuration
     * also sets up the return packet to send to the Free SPOT
     */
    private void setGraphDisplay() {

        boolean accelorometerTiltGraphIsSet = false;
        boolean accelorometerGraphIsSet = false;
        //initListener(currentSPOT);                      // listener initilized for spot

        int x;                                            // number of items on dnd list
        x = sd[currentSPOT].listEmpty.getModel().getSize();

        spotReturnType[currentSPOT] = new Vector();             // return vector with list of sensors to setup

        graphPanelSPOT[currentSPOT] = new JPanel(new GridLayout(1, x));     // panel to hold sensor display for 1 spot
        TitledBorder border = new TitledBorder("Graphs for SPOT " + (currentSPOT + 1));
        graphPanelSPOT[currentSPOT].setBorder(border);

        // buttons to display sensor graph

        for (int p = 0; p < MAXSENSORS; p++) {

            graphPanelSensors[currentSPOT][p] = new JPanel();
            graphPanelSensors[currentSPOT][p].setLayout(new BorderLayout(1, 2));

            graphYaxisPanelSensors[currentSPOT][p] = new JPanel();
            graphYaxisPanelSensors[currentSPOT][p].setSize(graphPanelSensors[currentSPOT][p].getWidth()/4, graphPanelSensors[currentSPOT][p].getHeight());
            //graphYaxisPanelSensors[currentSPOT][p].setLayout(new BorderLayout());
        }

        // string array to compare which sensors have been added in the drag and drop

        String[] elements = new String[x];
        for (int i = 0; i < x; i++) {
            elements[i] = sd[currentSPOT].listEmpty.getModel().getElementAt(i).toString();
//            if (elements[i].contains("ACCELEROMETER SENSOR TILT")) {
//                if (!accelorometerTiltGraphIsSet) {
//                    TitledBorder borderAccTilt = new TitledBorder("Accelerometer Tilt ");
//                    graphPanelSensors[currentSPOT][0].setBorder(borderAccTilt);
//                    //graphPanelSensors[currentSPOT][0].setPreferredSize(dimen2);
//                    //graphPanelSensors[currentSPOT][0].add(graphYaxisPanelSensors[currentSPOT][0], BorderLayout.PAGE_START);
//                    graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][0]);
//
//                    setGraphView(graphView[currentSPOT][0], currentSPOT, 0);
//                    validate();
//                    accelorometerTiltGraphIsSet = true;
//                }
                if (elements[i].equals("ACCELEROMETER SENSOR TILT X")) {
                    addToReturnVector(ACCELEROMETER_SENSOR_TILT_X, currentSPOT);
                    TitledBorder borderAccTilt = new TitledBorder("Accelerometer Tilt X ");
                    graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_TILT_X].setBorder(borderAccTilt);
                    graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_TILT_X]);
                    graphView[currentSPOT][ACCELEROMETER_SENSOR_TILT_X] = new GraphView();
                    setGraphView(graphView[currentSPOT][ACCELEROMETER_SENSOR_TILT_X], currentSPOT, ACCELEROMETER_SENSOR_TILT_X);
                    validate();
                }
                if (elements[i].equals("ACCELEROMETER SENSOR TILT Y")) {
                    addToReturnVector(ACCELEROMETER_SENSOR_TILT_Y, currentSPOT);
                    TitledBorder borderAccTilt = new TitledBorder("Accelerometer Tilt Y ");
                    graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_TILT_Y].setBorder(borderAccTilt);
                    graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_TILT_Y]);
                    graphView[currentSPOT][ACCELEROMETER_SENSOR_TILT_Y] = new GraphView();
                    setGraphView(graphView[currentSPOT][ACCELEROMETER_SENSOR_TILT_Y], currentSPOT, ACCELEROMETER_SENSOR_TILT_Y);
                    validate();
                }
                if (elements[i].equals("ACCELEROMETER SENSOR TILT Z")) {
                    addToReturnVector(ACCELEROMETER_SENSOR_TILT_Z, currentSPOT);
                    TitledBorder borderAccTilt = new TitledBorder("Accelerometer Tilt Z ");
                    graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_TILT_Z].setBorder(borderAccTilt);
                    graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_TILT_Z]);
                    graphView[currentSPOT][ACCELEROMETER_SENSOR_TILT_Z] = new GraphView();
                    setGraphView(graphView[currentSPOT][ACCELEROMETER_SENSOR_TILT_Z], currentSPOT, ACCELEROMETER_SENSOR_TILT_Z);
                    validate();
                }
//            }

//            if ((elements[i].startsWith("ACCELEROMETER")) && (elements[i].length() < 23)) {
//                if (!accelorometerGraphIsSet) {
//                    TitledBorder borderAcc = new TitledBorder("Accelerometer");
//                    graphPanelSensors[currentSPOT][1].setBorder(borderAcc);
//                    //graphPanelSensors[currentSPOT][1].setPreferredSize(dimen2);
//                    graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][1]);
//                    setGraphView(graphView[currentSPOT][1], currentSPOT, 1);
//                    validate();
//                    accelorometerGraphIsSet = true;
//                }
                if (elements[i].equals("ACCELEROMETER SENSOR X")) {
                    addToReturnVector(ACCELEROMETER_SENSOR_X, currentSPOT);
                    TitledBorder borderAccTilt = new TitledBorder("Accelerometer X ");
                    graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_X].setBorder(borderAccTilt);
                    graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_X]);
                    graphView[currentSPOT][ACCELEROMETER_SENSOR_X] = new GraphView();
                    setGraphView(graphView[currentSPOT][ACCELEROMETER_SENSOR_X], currentSPOT, ACCELEROMETER_SENSOR_X);
                    validate();
                }
                if (elements[i].equals("ACCELEROMETER SENSOR Y")) {
                    addToReturnVector(ACCELEROMETER_SENSOR_Y, currentSPOT);
                    TitledBorder borderAccTilt = new TitledBorder("Accelerometer Y ");
                    graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_Y].setBorder(borderAccTilt);
                    graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_Y]);
                    graphView[currentSPOT][ACCELEROMETER_SENSOR_Y] = new GraphView();
                    setGraphView(graphView[currentSPOT][ACCELEROMETER_SENSOR_Y], currentSPOT, ACCELEROMETER_SENSOR_Y);
                    validate();
                }
                if (elements[i].equals("ACCELEROMETER SENSOR Z")) {
                    addToReturnVector(ACCELEROMETER_SENSOR_Z, currentSPOT);
                    TitledBorder borderAccTilt = new TitledBorder("Accelerometer Z ");
                    graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_Z].setBorder(borderAccTilt);
                    graphView[currentSPOT][ACCELEROMETER_SENSOR_Z] = new GraphView();
                    graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][ACCELEROMETER_SENSOR_Z]);
                    setGraphView(graphView[currentSPOT][ACCELEROMETER_SENSOR_Z], currentSPOT, ACCELEROMETER_SENSOR_Z);
                    validate();
                }
//            }
            if (elements[i].equalsIgnoreCase("TEMPRATURE SENSOR")) {
                addToReturnVector(TEMP_SENSOR, currentSPOT);
                TitledBorder borderTem = new TitledBorder("Temprature");
                graphPanelSensors[currentSPOT][TEMP_SENSOR].setBorder(borderTem);
                //graphPanelSensors[currentSPOT][2].setPreferredSize(dimen2);
                graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][TEMP_SENSOR]);
                setGraphView(graphView[currentSPOT][TEMP_SENSOR], currentSPOT, TEMP_SENSOR);
                validate();
                
            }
            if (elements[i].equalsIgnoreCase("LIGHT SENSOR")) {
                addToReturnVector(LIGHT_SENSOR, currentSPOT);
                TitledBorder borderLig = new TitledBorder("Light");
                graphPanelSensors[currentSPOT][LIGHT_SENSOR].setBorder(borderLig);
                //graphPanelSensors[currentSPOT][3].setPreferredSize(dimen2);
                graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][LIGHT_SENSOR]);
                setGraphView(graphView[currentSPOT][LIGHT_SENSOR], currentSPOT, LIGHT_SENSOR);
                validate();
                
            }
            if (elements[i].equalsIgnoreCase("SENSOR PORT A0")) {
                addToReturnVector(A0, currentSPOT);
                TitledBorder borderA0 = new TitledBorder("Sensor at A0");
                graphPanelSensors[currentSPOT][A0].setBorder(borderA0);
                //graphPanelSensors[currentSPOT][4].setPreferredSize(dimen2);
                graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][A0]);
                setGraphView(graphView[currentSPOT][A0], currentSPOT, A0);
                validate();
                
            }
            if (elements[i].equalsIgnoreCase("SENSOR PORT A1")) {
                addToReturnVector(A1, currentSPOT);
                TitledBorder borderA1 = new TitledBorder("Sensor at A1");
                graphPanelSensors[currentSPOT][A1].setBorder(borderA1);
                //graphPanelSensors[currentSPOT][5].setPreferredSize(dimen2);
                graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][A1]);
                setGraphView(graphView[currentSPOT][A1], currentSPOT, A1);
                validate();
                
            }
            if (elements[i].equalsIgnoreCase("SENSOR PORT A2")) {
                addToReturnVector(A2, currentSPOT);
                TitledBorder borderA2 = new TitledBorder("Sensor at A2");
                graphPanelSensors[currentSPOT][A2].setBorder(borderA2);
                //graphPanelSensors[currentSPOT][6].setPreferredSize(dimen2);
                graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][A2]);
                setGraphView(graphView[currentSPOT][A2], currentSPOT, A2);
                validate();
                
            }
            if (elements[i].equalsIgnoreCase("SENSOR PORT A3")) {

                addToReturnVector(A3, currentSPOT);
                TitledBorder borderA3 = new TitledBorder("Sensor at A3");
                graphPanelSensors[currentSPOT][A3].setBorder(borderA3);
                //graphPanelSensors[currentSPOT][7].setPreferredSize(dimen2);
                graphPanelSPOT[currentSPOT].add(graphPanelSensors[currentSPOT][A3]);
                setGraphView(graphView[currentSPOT][A3], currentSPOT, A3);
                validate();
                
            }
        }
        graphPanelSPOT[currentSPOT].revalidate();
        jPanelMainGraphSubPanel.add(graphPanelSPOT[currentSPOT]);
        jPanelMainGraphSubPanel.revalidate();
        repaint();
    }

    private void prepareMainGraphSubPanel() {
        jPanelMainGraphSubPanel.setLayout(new BoxLayout(jPanelMainGraphSubPanel, BoxLayout.PAGE_AXIS));
        jPanelMainGraphSubPanel.setAutoscrolls(true);
    }

    /**
     *
     * @param currentSpot
     * @return
     */
    private boolean waitForSpotSensorConfig(int currentSpot) {
        boolean completedConfig = false;


        setMainDisplayPanel(jPanelConfigureSensorStatusUpdate);
        // wait for confirmation from spot of sensor setup


        return completedConfig;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanelAccGraph = new javax.swing.JPanel();
        y_axisPanel = new javax.swing.JPanel();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabelConnectionStatus = new javax.swing.JLabel();
        jLabelConnection = new javax.swing.JLabel();
        jRadioButton2G = new javax.swing.JRadioButton();
        jRadioButton6G = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        graphViewScrollPane = new javax.swing.JScrollPane();
        jPanelLoginPanel = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jButtonLogin = new javax.swing.JButton();
        jButtonReset = new javax.swing.JButton();
        jButtonExit = new javax.swing.JButton();
        jLabelLogin = new javax.swing.JLabel();
        jLabelPassword = new javax.swing.JLabel();
        jTextFieldLogin = new javax.swing.JTextField();
        jPasswordFieldPassword = new javax.swing.JPasswordField();
        jLabelLoginStatus = new javax.swing.JLabel();
        jPanelPatientSearch = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jLabelPatientSearchName = new javax.swing.JLabel();
        jTextFieldPatientSearchName = new javax.swing.JTextField();
        jLabelPatientSearchLast = new javax.swing.JLabel();
        jTextFieldPatientSearchLast = new javax.swing.JTextField();
        jButtonPatientSearchSearch = new javax.swing.JButton();
        jButtonPatientSearchReset = new javax.swing.JButton();
        jButtonPatientSearchGoBack = new javax.swing.JButton();
        jLabelPatientSearchStatus = new javax.swing.JLabel();
        jPanelTaskSelector = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jButtonSettings = new javax.swing.JButton();
        jButtonSearchPatient = new javax.swing.JButton();
        jButtonNewTherapist = new javax.swing.JButton();
        jButtonNewPatient = new javax.swing.JButton();
        jButtonExit1 = new javax.swing.JButton();
        jPanelAddNewTherapist = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jLabelName = new javax.swing.JLabel();
        jLabelGender = new javax.swing.JLabel();
        jLabelTherapisttId = new javax.swing.JLabel();
        jLabelAddress = new javax.swing.JLabel();
        jLabelCity = new javax.swing.JLabel();
        jLabelState = new javax.swing.JLabel();
        jButtonAdd = new javax.swing.JButton();
        jButtonResetTherapist = new javax.swing.JButton();
        jButtonExitTherapist = new javax.swing.JButton();
        jTextFieldState = new javax.swing.JTextField();
        jTextFieldCity = new javax.swing.JTextField();
        jTextFieldAddress = new javax.swing.JTextField();
        jComboBoxGender = new javax.swing.JComboBox();
        jTextFieldFirstName = new javax.swing.JTextField();
        jTextFieldPatientId = new javax.swing.JTextField();
        jLabelTherapistSSN = new javax.swing.JLabel();
        jLabelLastName = new javax.swing.JLabel();
        jLabelAge = new javax.swing.JLabel();
        jTextFieldTherapistSSN = new javax.swing.JTextField();
        jTextFieldAge = new javax.swing.JTextField();
        jTextFieldLastName = new javax.swing.JTextField();
        jPanelAddNewPatient1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabelName1 = new javax.swing.JLabel();
        jLabelGender1 = new javax.swing.JLabel();
        jLabelPatientId1 = new javax.swing.JLabel();
        jLabelAddress1 = new javax.swing.JLabel();
        jLabelCity2 = new javax.swing.JLabel();
        jLabelCity3 = new javax.swing.JLabel();
        jButtonAddPatient = new javax.swing.JButton();
        jButtonResetPatient = new javax.swing.JButton();
        jButtonGoBackPatient = new javax.swing.JButton();
        jTextFieldAddress1 = new javax.swing.JTextField();
        jTextFieldPatientId1 = new javax.swing.JTextField();
        jTextFieldFirstName1 = new javax.swing.JTextField();
        jComboBoxGender1 = new javax.swing.JComboBox();
        jLabelLastName1 = new javax.swing.JLabel();
        jLabelAge1 = new javax.swing.JLabel();
        jTextFieldLastName1 = new javax.swing.JTextField();
        jTextFieldAge1 = new javax.swing.JTextField();
        jTextFieldState1 = new javax.swing.JTextField();
        jTextFieldCity1 = new javax.swing.JTextField();
        jPanelPatientSearchResult = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jButtonPatientSearchResultViewHistory = new javax.swing.JButton();
        jButtonPatientSearchResultStartNewSession = new javax.swing.JButton();
        jButtonPatientSearchResultGoBack = new javax.swing.JButton();
        jLabelName2 = new javax.swing.JLabel();
        jLabelGender2 = new javax.swing.JLabel();
        jLabelPatientId2 = new javax.swing.JLabel();
        jLabelPatientSearchResultAddress = new javax.swing.JLabel();
        jLabellPatientSearchResultCity = new javax.swing.JLabel();
        jLabelPatientSearchResultCity = new javax.swing.JLabel();
        jComboBoxPatientSearchResultGender = new javax.swing.JComboBox();
        jTextFieldPatientSearchResultPatientName = new javax.swing.JTextField();
        jLabePatientSearchResultlLastName = new javax.swing.JLabel();
        jTextFieldPatientSearchResultPatientLast = new javax.swing.JTextField();
        jLabePatientSearchResultlAge = new javax.swing.JLabel();
        jTextFieldPatientSearchResultPatientAge = new javax.swing.JTextField();
        jTextFieldPatientSearchResultPatientAddress = new javax.swing.JTextField();
        jTextFieldPatientSearchResultPatientState = new javax.swing.JTextField();
        jTextFieldPatientSearchResultPatientCity = new javax.swing.JTextField();
        jTextFieldPatientSearchResultPatientID = new javax.swing.JTextField();
        jPanelNewSession = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jPanelDeviceDiscoveredWarning = new javax.swing.JLabel();
        jButtonNewSessionConfigure = new javax.swing.JButton();
        jButtonNewSessionGoBack = new javax.swing.JButton();
        jPanelDeviceDiscovered = new javax.swing.JPanel();
        jLabelNewSessionStatus = new javax.swing.JLabel();
        jProgressBarSpotsDiscovered = new javax.swing.JProgressBar();
        jPanelConfigureSensor = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jButtonConfigureSensorGoBack = new javax.swing.JButton();
        jButtonConfigureSensorConfigureSpot = new javax.swing.JButton();
        jPanelDnD = new javax.swing.JPanel();
        jLabelConfigureSensorStatus = new javax.swing.JLabel();
        jPanelConfigureSensorStatusUpdate = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jProgressBarSensorStatusUpdate = new javax.swing.JProgressBar();
        jButtonConfigureSensorStatusUpdateConfigureSpotNext = new javax.swing.JButton();
        jButtonConfigureSensorStatusUpdateGoBack1 = new javax.swing.JButton();
        jLabelConfigureSensorStatusUpdate = new javax.swing.JLabel();
        jPanelMainGraphPanel = new javax.swing.JPanel();
        jPanelMainGraphSubPanel = new javax.swing.JPanel();
        jPanelMultiplePatients = new javax.swing.JPanel();
        jPanelMultiplePatientFound = new javax.swing.JPanel();
        jPanelMultiplePatientFoundSelectPatient = new javax.swing.JButton();
        jButtonlMultiplePatientFoundBack = new javax.swing.JButton();
        jPanel11 = new javax.swing.JPanel();
        jToolBarDefaultToolbar = new javax.swing.JToolBar();
        jButtonStartLogging = new javax.swing.JButton();
        jButtonSaveSession = new javax.swing.JButton();
        jButtonDiscardSession = new javax.swing.JButton();
        jButtonRetrieve = new javax.swing.JButton();
        jPanelMainPanel = new javax.swing.JPanel();
        jMenuBarTop = new javax.swing.JMenuBar();
        jMenuFile = new javax.swing.JMenu();
        jMenuItemNewRecord = new javax.swing.JMenuItem();
        jMenuItemOpenPatientRecord = new javax.swing.JMenuItem();
        jMenuItemNewTherapist = new javax.swing.JMenuItem();
        jMenuItemSave = new javax.swing.JMenuItem();
        jMenuItemSaveAs = new javax.swing.JMenuItem();
        jMenuItemChangeUser = new javax.swing.JMenuItem();
        jMenuItemCloseRecord = new javax.swing.JMenuItem();
        jMenuItemExit = new javax.swing.JMenuItem();
        jMenuEdit = new javax.swing.JMenu();
        jMenuItemCopy = new javax.swing.JMenuItem();
        jMenuItemCut = new javax.swing.JMenuItem();
        jMenuItemPaste = new javax.swing.JMenuItem();
        jMenuData = new javax.swing.JMenu();
        jMenuItemSaveSession = new javax.swing.JMenuItem();
        jMenuItemViewSavedData = new javax.swing.JMenuItem();
        jMenuSensor = new javax.swing.JMenu();
        jMenuItemAddRemoveSensor = new javax.swing.JMenuItem();

        jPanelAccGraph.setBorder(javax.swing.BorderFactory.createTitledBorder("Accelorometer Graph"));
        jPanelAccGraph.setPreferredSize(new java.awt.Dimension(668, 401));
        jPanelAccGraph.addContainerListener(new java.awt.event.ContainerAdapter() {
            public void componentAdded(java.awt.event.ContainerEvent evt) {
                jPanelAccGraphComponentAdded(evt);
            }
        });

        y_axisPanel.setAlignmentX(1.0F);
        y_axisPanel.setAlignmentY(0.0F);
        y_axisPanel.setMaximumSize(new java.awt.Dimension(65, 3725));
        y_axisPanel.setMinimumSize(new java.awt.Dimension(65, 125));
        y_axisPanel.setOpaque(false);

        javax.swing.GroupLayout jPanelAccGraphLayout = new javax.swing.GroupLayout(jPanelAccGraph);
        jPanelAccGraph.setLayout(jPanelAccGraphLayout);
        jPanelAccGraphLayout.setHorizontalGroup(
            jPanelAccGraphLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelAccGraphLayout.createSequentialGroup()
                .addComponent(y_axisPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                .addContainerGap(556, Short.MAX_VALUE))
        );
        jPanelAccGraphLayout.setVerticalGroup(
            jPanelAccGraphLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelAccGraphLayout.createSequentialGroup()
                .addComponent(y_axisPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 363, Short.MAX_VALUE)
                .addContainerGap())
        );

        jLayeredPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLayeredPane1MouseClicked(evt);
            }
        });
        jLayeredPane1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                jLayeredPane1MouseDragged(evt);
            }
        });

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "x", "y", "z", "Time"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Long.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(jTable1);

        jLabelConnectionStatus.setText("Connection Status: ");

        jLabelConnection.setText("Connection");
        jLabelConnection.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jLabelConnectionPropertyChange(evt);
            }
        });

        buttonGroup1.add(jRadioButton2G);
        jRadioButton2G.setText("2G");
        jRadioButton2G.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton2GActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton6G);
        jRadioButton6G.setText("6G");
        jRadioButton6G.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton6GActionPerformed(evt);
            }
        });

        jLabel4.setText("Scale:");

        graphViewScrollPane.setBorder(null);
        graphViewScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        graphViewScrollPane.setMaximumSize(new java.awt.Dimension(32767, 7725));
        graphViewScrollPane.setMinimumSize(new java.awt.Dimension(350, 125));
        graphViewScrollPane.setOpaque(false);
        graphViewScrollPane.setPreferredSize(new java.awt.Dimension(800, 525));
        graphViewScrollPane.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                graphViewScrollPaneMouseClicked(evt);
            }
        });

        jPanelLoginPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("User Login"));
        jPanelLoginPanel.setPreferredSize(new java.awt.Dimension(500, 420));

        jButtonLogin.setText("Log On");
        jButtonLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLoginActionPerformed(evt);
            }
        });

        jButtonReset.setText("Reset");
        jButtonReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonResetActionPerformed(evt);
            }
        });

        jButtonExit.setText("Exit");
        jButtonExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonExitActionPerformed(evt);
            }
        });

        jLabelLogin.setText("Login ");

        jLabelPassword.setText("Password");

        jTextFieldLogin.setText(" ");
        jTextFieldLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldLoginActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(80, 80, 80)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelLoginStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jButtonLogin)
                            .addGap(49, 49, 49)
                            .addComponent(jButtonReset)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButtonExit))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabelLogin)
                                .addComponent(jLabelPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(39, 39, 39)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jTextFieldLogin)
                                .addComponent(jPasswordFieldPassword, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)))))
                .addContainerGap(37, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelLogin)
                    .addComponent(jTextFieldLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelPassword)
                    .addComponent(jPasswordFieldPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(48, 48, 48)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
                    .addComponent(jButtonReset)
                    .addComponent(jButtonExit))
                .addGap(30, 30, 30)
                .addComponent(jLabelLoginStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20))
        );

        jPanelLoginPanel.add(jPanel1);

        jPanelPatientSearch.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Patient"));
        jPanelPatientSearch.setPreferredSize(new java.awt.Dimension(500, 420));

        jLabelPatientSearchName.setText("First Name");

        jLabelPatientSearchLast.setText("Last Name");

        jButtonPatientSearchSearch.setText("Search");
        jButtonPatientSearchSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPatientSearchSearchActionPerformed(evt);
            }
        });

        jButtonPatientSearchReset.setText("Reset");
        jButtonPatientSearchReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPatientSearchResetActionPerformed(evt);
            }
        });

        jButtonPatientSearchGoBack.setText("Back");
        jButtonPatientSearchGoBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPatientSearchGoBackActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabelPatientSearchLast)
                        .addGap(23, 23, 23)
                        .addComponent(jTextFieldPatientSearchLast, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jButtonPatientSearchSearch)
                        .addGap(27, 27, 27)
                        .addComponent(jButtonPatientSearchReset)
                        .addGap(18, 18, 18)
                        .addComponent(jButtonPatientSearchGoBack))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jLabelPatientSearchName)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldPatientSearchName, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabelPatientSearchStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 276, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(59, Short.MAX_VALUE))
        );

        jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButtonPatientSearchGoBack, jButtonPatientSearchReset, jButtonPatientSearchSearch});

        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelPatientSearchName)
                    .addComponent(jTextFieldPatientSearchName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldPatientSearchLast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelPatientSearchLast))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonPatientSearchSearch)
                    .addComponent(jButtonPatientSearchReset)
                    .addComponent(jButtonPatientSearchGoBack))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabelPatientSearchStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35))
        );

        jPanelPatientSearch.add(jPanel7);

        jPanelTaskSelector.setBorder(javax.swing.BorderFactory.createTitledBorder("What would you like to do?"));
        jPanelTaskSelector.setPreferredSize(new java.awt.Dimension(500, 420));

        jButtonSettings.setText("Settings");

        jButtonSearchPatient.setText("Search Patients");
        jButtonSearchPatient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSearchPatientActionPerformed(evt);
            }
        });

        jButtonNewTherapist.setText("Create New Therapist Profile");
        jButtonNewTherapist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNewTherapistActionPerformed(evt);
            }
        });

        jButtonNewPatient.setText("Create New Patient Profile");
        jButtonNewPatient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNewPatientActionPerformed(evt);
            }
        });

        jButtonExit1.setText("Exit");
        jButtonExit1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonExit1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 191, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                        .addComponent(jButtonSettings)
                        .addComponent(jButtonSearchPatient)
                        .addComponent(jButtonNewTherapist)
                        .addComponent(jButtonNewPatient)
                        .addComponent(jButtonExit1))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButtonExit1, jButtonNewPatient, jButtonNewTherapist, jButtonSearchPatient, jButtonSettings});

        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 382, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(35, 35, 35)
                    .addComponent(jButtonNewPatient)
                    .addGap(18, 18, 18)
                    .addComponent(jButtonNewTherapist)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 113, Short.MAX_VALUE)
                    .addComponent(jButtonSearchPatient)
                    .addGap(18, 18, 18)
                    .addComponent(jButtonSettings)
                    .addGap(48, 48, 48)
                    .addComponent(jButtonExit1)
                    .addGap(35, 35, 35)))
        );

        jPanelTaskSelector.add(jPanel2);

        jPanelAddNewTherapist.setBorder(javax.swing.BorderFactory.createTitledBorder("Add New Therapist"));
        jPanelAddNewTherapist.setPreferredSize(new java.awt.Dimension(530, 350));

        jLabelName.setText("First Name");

        jLabelGender.setText("Gender");

        jLabelTherapisttId.setText("Therapist ID :");

        jLabelAddress.setText("Address");

        jLabelCity.setText("City");

        jLabelState.setText("State");

        jButtonAdd.setText("Add");
        jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAddActionPerformed(evt);
            }
        });

        jButtonResetTherapist.setText("Reset");
        jButtonResetTherapist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonResetTherapistActionPerformed(evt);
            }
        });

        jButtonExitTherapist.setText("Go Back");
        jButtonExitTherapist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonExitTherapistActionPerformed(evt);
            }
        });

        jComboBoxGender.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Male", "Female" }));
        jComboBoxGender.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxGenderActionPerformed(evt);
            }
        });

        jLabelTherapistSSN.setText("SSN");

        jLabelLastName.setText("Last Name");

        jLabelAge.setText("Age");

        jTextFieldAge.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldAgeActionPerformed(evt);
            }
        });

        jTextFieldLastName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldLastNameActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 432, Short.MAX_VALUE)
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabelName)
                        .addComponent(jLabelGender)
                        .addComponent(jLabelTherapisttId)
                        .addComponent(jLabelAddress)
                        .addComponent(jLabelCity)
                        .addComponent(jLabelState))
                    .addGap(20, 20, 20)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addGap(20, 20, 20)
                            .addComponent(jButtonAdd)
                            .addGap(43, 43, 43)
                            .addComponent(jButtonResetTherapist)
                            .addGap(38, 38, 38)
                            .addComponent(jButtonExitTherapist))
                        .addComponent(jTextFieldAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                                    .addComponent(jComboBoxGender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(93, 93, 93))
                                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jTextFieldFirstName, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTextFieldPatientId, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel8Layout.createSequentialGroup()
                                    .addGap(31, 31, 31)
                                    .addComponent(jLabelTherapistSSN))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabelLastName)
                                    .addComponent(jLabelAge)))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jTextFieldTherapistSSN, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE)
                                .addComponent(jTextFieldAge, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jTextFieldLastName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jTextFieldState, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jTextFieldCity, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(132, 132, 132)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 285, Short.MAX_VALUE)
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelTherapisttId)
                                .addComponent(jTextFieldPatientId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelTherapistSSN))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelName)
                                .addComponent(jTextFieldFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelGender)
                                .addComponent(jComboBoxGender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addComponent(jLabelLastName)
                            .addGap(18, 18, 18)
                            .addComponent(jLabelAge))
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addComponent(jTextFieldTherapistSSN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jTextFieldLastName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jTextFieldAge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(3, 3, 3)))
                    .addGap(18, 18, 18)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addComponent(jLabelAddress)
                            .addGap(24, 24, 24)
                            .addComponent(jLabelCity)
                            .addGap(18, 18, 18)
                            .addComponent(jLabelState))
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addComponent(jTextFieldAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(24, 24, 24)
                            .addComponent(jTextFieldCity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jTextFieldState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(21, 21, 21)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButtonAdd)
                        .addComponent(jButtonResetTherapist)
                        .addComponent(jButtonExitTherapist))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jPanelAddNewTherapist.add(jPanel8);

        jPanelAddNewPatient1.setBorder(javax.swing.BorderFactory.createTitledBorder("Add New Patient"));
        jPanelAddNewPatient1.setPreferredSize(new java.awt.Dimension(530, 350));

        jLabelName1.setText("First Name");

        jLabelGender1.setText("Gender");

        jLabelPatientId1.setText("Patient ID :");

        jLabelAddress1.setText("Address");

        jLabelCity2.setText("City");

        jLabelCity3.setText("State");

        jButtonAddPatient.setText("Add");
        jButtonAddPatient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAddPatientActionPerformed(evt);
            }
        });

        jButtonResetPatient.setText("Reset");
        jButtonResetPatient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonResetPatientActionPerformed(evt);
            }
        });

        jButtonGoBackPatient.setText("Go Back");
        jButtonGoBackPatient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGoBackPatientActionPerformed(evt);
            }
        });

        jComboBoxGender1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Male", "Female" }));
        jComboBoxGender1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxGender1ActionPerformed(evt);
            }
        });

        jLabelLastName1.setText("Last Name");

        jLabelAge1.setText("Age");

        jTextFieldLastName1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldLastName1ActionPerformed(evt);
            }
        });

        jTextFieldAge1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldAge1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(96, Short.MAX_VALUE)
                .addComponent(jButtonAddPatient)
                .addGap(43, 43, 43)
                .addComponent(jButtonResetPatient)
                .addGap(38, 38, 38)
                .addComponent(jButtonGoBackPatient)
                .addGap(91, 91, 91))
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelCity3)
                .addContainerGap(415, Short.MAX_VALUE))
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelAddress1)
                .addContainerGap(402, Short.MAX_VALUE))
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelCity2)
                .addContainerGap(422, Short.MAX_VALUE))
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabelName1)
                        .addComponent(jLabelGender1)
                        .addComponent(jLabelPatientId1))
                    .addGap(20, 20, 20)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jTextFieldAddress1, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTextFieldPatientId1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jTextFieldFirstName1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jComboBoxGender1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(77, 77, 77)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabelLastName1)
                                .addComponent(jLabelAge1))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jTextFieldLastName1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jTextFieldAge1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jTextFieldState1, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jTextFieldCity1, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(116, 116, 116)))
                    .addContainerGap(56, Short.MAX_VALUE)))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGap(128, 128, 128)
                .addComponent(jLabelAddress1)
                .addGap(34, 34, 34)
                .addComponent(jLabelCity2)
                .addGap(18, 18, 18)
                .addComponent(jLabelCity3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonAddPatient)
                    .addComponent(jButtonResetPatient)
                    .addComponent(jButtonGoBackPatient))
                .addGap(29, 29, 29))
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelPatientId1)
                                .addComponent(jTextFieldPatientId1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelName1)
                                .addComponent(jTextFieldFirstName1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelGender1)
                                .addComponent(jComboBoxGender1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelLastName1)
                                .addComponent(jTextFieldLastName1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelAge1)
                                .addComponent(jTextFieldAge1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(18, 18, 18)
                    .addComponent(jTextFieldAddress1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(24, 24, 24)
                    .addComponent(jTextFieldCity1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jTextFieldState1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(78, Short.MAX_VALUE)))
        );

        jPanelAddNewPatient1.add(jPanel3);

        jPanelPatientSearchResult.setBorder(javax.swing.BorderFactory.createTitledBorder("Patient Result"));
        jPanelPatientSearchResult.setPreferredSize(new java.awt.Dimension(530, 350));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jPanelPatientSearchResult.add(jPanel4);

        jButtonPatientSearchResultViewHistory.setText("View History");
        jButtonPatientSearchResultViewHistory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPatientSearchResultViewHistoryActionPerformed(evt);
            }
        });

        jButtonPatientSearchResultStartNewSession.setText("Start New Session");
        jButtonPatientSearchResultStartNewSession.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPatientSearchResultStartNewSessionActionPerformed(evt);
            }
        });

        jButtonPatientSearchResultGoBack.setText("Go Back");
        jButtonPatientSearchResultGoBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPatientSearchResultGoBackActionPerformed(evt);
            }
        });

        jLabelName2.setText("First Name");

        jLabelGender2.setText("Gender");

        jLabelPatientId2.setText("Patient ID :");

        jLabelPatientSearchResultAddress.setText("Address");

        jLabellPatientSearchResultCity.setText("City");

        jLabelPatientSearchResultCity.setText("State");

        jComboBoxPatientSearchResultGender.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Male", "Female" }));
        jComboBoxPatientSearchResultGender.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxPatientSearchResultGenderActionPerformed(evt);
            }
        });

        jTextFieldPatientSearchResultPatientName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPatientSearchResultPatientNameActionPerformed(evt);
            }
        });

        jLabePatientSearchResultlLastName.setText("Last Name");

        jTextFieldPatientSearchResultPatientLast.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPatientSearchResultPatientLastActionPerformed(evt);
            }
        });

        jLabePatientSearchResultlAge.setText("Age");

        jTextFieldPatientSearchResultPatientAge.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPatientSearchResultPatientAgeActionPerformed(evt);
            }
        });

        jTextFieldPatientSearchResultPatientAddress.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPatientSearchResultPatientAddressActionPerformed(evt);
            }
        });

        jTextFieldPatientSearchResultPatientState.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPatientSearchResultPatientStateActionPerformed(evt);
            }
        });

        jTextFieldPatientSearchResultPatientCity.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPatientSearchResultPatientCityActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 423, Short.MAX_VALUE)
            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addComponent(jButtonPatientSearchResultViewHistory)
                            .addGap(43, 43, 43)
                            .addComponent(jButtonPatientSearchResultStartNewSession)
                            .addGap(38, 38, 38)
                            .addComponent(jButtonPatientSearchResultGoBack))
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabelName2)
                                .addComponent(jLabelGender2)
                                .addComponent(jLabelPatientId2)
                                .addComponent(jLabelPatientSearchResultAddress)
                                .addComponent(jLabellPatientSearchResultCity)
                                .addComponent(jLabelPatientSearchResultCity))
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                    .addGap(20, 20, 20)
                                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel10Layout.createSequentialGroup()
                                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jComboBoxPatientSearchResultGender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jTextFieldPatientSearchResultPatientName, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(44, 44, 44)
                                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                .addGroup(jPanel10Layout.createSequentialGroup()
                                                    .addComponent(jLabePatientSearchResultlLastName)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(jTextFieldPatientSearchResultPatientLast, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(jPanel10Layout.createSequentialGroup()
                                                    .addComponent(jLabePatientSearchResultlAge)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                    .addComponent(jTextFieldPatientSearchResultPatientAge, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(76, 76, 76))))
                                        .addComponent(jTextFieldPatientSearchResultPatientAddress, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
                                        .addGroup(jPanel10Layout.createSequentialGroup()
                                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jTextFieldPatientSearchResultPatientState, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jTextFieldPatientSearchResultPatientCity, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(118, 118, 118))))
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                    .addGap(18, 18, 18)
                                    .addComponent(jTextFieldPatientSearchResultPatientID, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addContainerGap()))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 284, Short.MAX_VALUE)
            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelPatientId2)
                                .addComponent(jTextFieldPatientSearchResultPatientID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelName2)
                                .addComponent(jTextFieldPatientSearchResultPatientName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabelGender2)
                                .addComponent(jComboBoxPatientSearchResultGender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabePatientSearchResultlLastName)
                                .addComponent(jTextFieldPatientSearchResultPatientLast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabePatientSearchResultlAge)
                                .addComponent(jTextFieldPatientSearchResultPatientAge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(18, 18, 18)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabelPatientSearchResultAddress)
                        .addComponent(jTextFieldPatientSearchResultPatientAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(24, 24, 24)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabellPatientSearchResultCity)
                        .addComponent(jTextFieldPatientSearchResultPatientCity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabelPatientSearchResultCity)
                        .addComponent(jTextFieldPatientSearchResultPatientState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(23, 23, 23)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButtonPatientSearchResultViewHistory)
                        .addComponent(jButtonPatientSearchResultStartNewSession)
                        .addComponent(jButtonPatientSearchResultGoBack))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jPanelPatientSearchResult.add(jPanel10);

        jPanelNewSession.setBorder(javax.swing.BorderFactory.createTitledBorder("Device List"));
        jPanelNewSession.setPreferredSize(new java.awt.Dimension(500, 420));

        jButtonNewSessionConfigure.setText("Configure Selected Devices");
        jButtonNewSessionConfigure.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNewSessionConfigureActionPerformed(evt);
            }
        });

        jButtonNewSessionGoBack.setText("Back");
        jButtonNewSessionGoBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNewSessionGoBackActionPerformed(evt);
            }
        });

        jLabelNewSessionStatus.setText("The following Devices were discovered. Please select SPOTs you wish to use");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap(77, Short.MAX_VALUE)
                .addComponent(jPanelDeviceDiscovered, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(67, 67, 67))
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(61, 61, 61)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanelDeviceDiscoveredWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jProgressBarSpotsDiscovered, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
                            .addComponent(jButtonNewSessionConfigure)
                            .addGap(71, 71, 71)
                            .addComponent(jButtonNewSessionGoBack))))
                .addContainerGap(75, Short.MAX_VALUE))
            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabelNewSessionStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 383, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(55, Short.MAX_VALUE)))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addComponent(jPanelDeviceDiscovered, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(2, 2, 2)
                .addComponent(jProgressBarSpotsDiscovered, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonNewSessionConfigure)
                    .addComponent(jButtonNewSessionGoBack))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanelDeviceDiscoveredWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabelNewSessionStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(346, Short.MAX_VALUE)))
        );

        jPanelNewSession.add(jPanel5);

        jPanelConfigureSensor.setBorder(javax.swing.BorderFactory.createTitledBorder("Configure SPOT 1"));
        jPanelConfigureSensor.setPreferredSize(new java.awt.Dimension(500, 420));

        jButtonConfigureSensorGoBack.setText("Back");
        jButtonConfigureSensorGoBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConfigureSensorGoBackActionPerformed(evt);
            }
        });

        jButtonConfigureSensorConfigureSpot.setText("Configure Free Spot");
        jButtonConfigureSensorConfigureSpot.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConfigureSensorConfigureSpotActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelConfigureSensorStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 448, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(85, 85, 85)
                        .addComponent(jButtonConfigureSensorConfigureSpot)
                        .addGap(111, 111, 111)
                        .addComponent(jButtonConfigureSensorGoBack)))
                .addGap(92, 92, 92))
            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanelDnD, javax.swing.GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(323, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonConfigureSensorConfigureSpot)
                    .addComponent(jButtonConfigureSensorGoBack))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelConfigureSensorStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanelDnD, javax.swing.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE)
                    .addGap(73, 73, 73)))
        );

        jPanelConfigureSensor.add(jPanel6);

        jPanelConfigureSensorStatusUpdate.setBorder(javax.swing.BorderFactory.createTitledBorder("Setting up SunSPOT"));
        jPanelConfigureSensorStatusUpdate.setPreferredSize(new java.awt.Dimension(500, 420));

        jButtonConfigureSensorStatusUpdateConfigureSpotNext.setText("Next");
        jButtonConfigureSensorStatusUpdateConfigureSpotNext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConfigureSensorStatusUpdateConfigureSpotNextActionPerformed(evt);
            }
        });

        jButtonConfigureSensorStatusUpdateGoBack1.setText("Back");
        jButtonConfigureSensorStatusUpdateGoBack1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConfigureSensorStatusUpdateGoBack1ActionPerformed(evt);
            }
        });

        jLabelConfigureSensorStatusUpdate.setText("Please wait while the SPOT is configured... ");

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButtonConfigureSensorStatusUpdateConfigureSpotNext)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 212, Short.MAX_VALUE)
                .addComponent(jButtonConfigureSensorStatusUpdateGoBack1)
                .addGap(37, 37, 37))
            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jProgressBarSensorStatusUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabelConfigureSensorStatusUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(41, Short.MAX_VALUE)))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap(284, Short.MAX_VALUE)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonConfigureSensorStatusUpdateGoBack1)
                    .addComponent(jButtonConfigureSensorStatusUpdateConfigureSpotNext))
                .addGap(21, 21, 21))
            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabelConfigureSensorStatusUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(205, 205, 205)
                    .addComponent(jProgressBarSensorStatusUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(81, Short.MAX_VALUE)))
        );

        jPanelConfigureSensorStatusUpdate.add(jPanel9);

        jPanelMainGraphPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Graphs of Selected SPOTs"));
        jPanelMainGraphPanel.setAutoscrolls(true);
        jPanelMainGraphPanel.setPreferredSize(new java.awt.Dimension(500, 420));
        jPanelMainGraphPanel.setLayout(new java.awt.GridLayout(1, 0));

        jPanelMainGraphSubPanel.setAutoscrolls(true);
        jPanelMainGraphSubPanel.setLayout(new java.awt.GridLayout(1, 0));
        jPanelMainGraphPanel.add(jPanelMainGraphSubPanel);

        javax.swing.GroupLayout jPanelMultiplePatientsLayout = new javax.swing.GroupLayout(jPanelMultiplePatients);
        jPanelMultiplePatients.setLayout(jPanelMultiplePatientsLayout);
        jPanelMultiplePatientsLayout.setHorizontalGroup(
            jPanelMultiplePatientsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 497, Short.MAX_VALUE)
        );
        jPanelMultiplePatientsLayout.setVerticalGroup(
            jPanelMultiplePatientsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 415, Short.MAX_VALUE)
        );

        jPanelMultiplePatientFound.setBorder(javax.swing.BorderFactory.createTitledBorder("Please Select a Patient"));
        jPanelMultiplePatientFound.setPreferredSize(new java.awt.Dimension(500, 420));

        jPanelMultiplePatientFoundSelectPatient.setText("Select Patient");
        jPanelMultiplePatientFoundSelectPatient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jPanelMultiplePatientFoundSelectPatientActionPerformed(evt);
            }
        });

        jButtonlMultiplePatientFoundBack.setText("Back");
        jButtonlMultiplePatientFoundBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonlMultiplePatientFoundBackActionPerformed(evt);
            }
        });

        jPanel11.setLayout(new javax.swing.BoxLayout(jPanel11, javax.swing.BoxLayout.LINE_AXIS));

        javax.swing.GroupLayout jPanelMultiplePatientFoundLayout = new javax.swing.GroupLayout(jPanelMultiplePatientFound);
        jPanelMultiplePatientFound.setLayout(jPanelMultiplePatientFoundLayout);
        jPanelMultiplePatientFoundLayout.setHorizontalGroup(
            jPanelMultiplePatientFoundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelMultiplePatientFoundLayout.createSequentialGroup()
                .addGroup(jPanelMultiplePatientFoundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelMultiplePatientFoundLayout.createSequentialGroup()
                        .addGap(113, 113, 113)
                        .addComponent(jPanelMultiplePatientFoundSelectPatient)
                        .addGap(88, 88, 88)
                        .addComponent(jButtonlMultiplePatientFoundBack))
                    .addGroup(jPanelMultiplePatientFoundLayout.createSequentialGroup()
                        .addGap(70, 70, 70)
                        .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(164, Short.MAX_VALUE))
        );
        jPanelMultiplePatientFoundLayout.setVerticalGroup(
            jPanelMultiplePatientFoundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelMultiplePatientFoundLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 308, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                .addGroup(jPanelMultiplePatientFoundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonlMultiplePatientFoundBack)
                    .addComponent(jPanelMultiplePatientFoundSelectPatient))
                .addGap(25, 25, 25))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jToolBarDefaultToolbar.setRollover(true);

        jButtonStartLogging.setText("Start Logging");
        jButtonStartLogging.setFocusable(false);
        jButtonStartLogging.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonStartLogging.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonStartLogging.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonStartLoggingActionPerformed(evt);
            }
        });
        jToolBarDefaultToolbar.add(jButtonStartLogging);

        jButtonSaveSession.setText("Save Session");
        jButtonSaveSession.setFocusable(false);
        jButtonSaveSession.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonSaveSession.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonSaveSession.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSaveSessionActionPerformed(evt);
            }
        });
        jToolBarDefaultToolbar.add(jButtonSaveSession);

        jButtonDiscardSession.setText("Discard Sesion");
        jButtonDiscardSession.setFocusable(false);
        jButtonDiscardSession.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonDiscardSession.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonDiscardSession.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDiscardSessionActionPerformed(evt);
            }
        });
        jToolBarDefaultToolbar.add(jButtonDiscardSession);

        jButtonRetrieve.setText("Retrieve");
        jButtonRetrieve.setFocusable(false);
        jButtonRetrieve.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonRetrieve.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonRetrieve.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRetrieveActionPerformed(evt);
            }
        });
        jToolBarDefaultToolbar.add(jButtonRetrieve);

        jPanelMainPanel.setAlignmentX(0.0F);
        jPanelMainPanel.setAutoscrolls(true);
        jPanelMainPanel.setPreferredSize(new java.awt.Dimension(500, 420));
        jPanelMainPanel.setRequestFocusEnabled(false);
        jPanelMainPanel.setLayout(new java.awt.GridLayout(1, 0));

        jMenuFile.setText("File");

        jMenuItemNewRecord.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemNewRecord.setText("New Patient Record");
        jMenuItemNewRecord.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemNewRecordActionPerformed(evt);
            }
        });
        jMenuFile.add(jMenuItemNewRecord);

        jMenuItemOpenPatientRecord.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemOpenPatientRecord.setText("Open Patient Record");
        jMenuFile.add(jMenuItemOpenPatientRecord);

        jMenuItemNewTherapist.setText("New Therapist");
        jMenuFile.add(jMenuItemNewTherapist);

        jMenuItemSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemSave.setText("Save");
        jMenuFile.add(jMenuItemSave);

        jMenuItemSaveAs.setText("Save As");
        jMenuFile.add(jMenuItemSaveAs);

        jMenuItemChangeUser.setText("Change User");
        jMenuItemChangeUser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemChangeUserActionPerformed(evt);
            }
        });
        jMenuFile.add(jMenuItemChangeUser);

        jMenuItemCloseRecord.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemCloseRecord.setText("Close Record");
        jMenuItemCloseRecord.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCloseRecordActionPerformed(evt);
            }
        });
        jMenuFile.add(jMenuItemCloseRecord);

        jMenuItemExit.setText("Exit");
        jMenuItemExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemExitActionPerformed(evt);
            }
        });
        jMenuFile.add(jMenuItemExit);

        jMenuBarTop.add(jMenuFile);

        jMenuEdit.setText("Edit");

        jMenuItemCopy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemCopy.setText("Copy");
        jMenuEdit.add(jMenuItemCopy);

        jMenuItemCut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemCut.setText("Cut");
        jMenuEdit.add(jMenuItemCut);

        jMenuItemPaste.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemPaste.setText("Paste");
        jMenuEdit.add(jMenuItemPaste);

        jMenuBarTop.add(jMenuEdit);

        jMenuData.setText("Data");

        jMenuItemSaveSession.setText("Save Current Session");
        jMenuData.add(jMenuItemSaveSession);

        jMenuItemViewSavedData.setText("View Saved Data");
        jMenuItemViewSavedData.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemViewSavedDataActionPerformed(evt);
            }
        });
        jMenuData.add(jMenuItemViewSavedData);

        jMenuBarTop.add(jMenuData);

        jMenuSensor.setText("Sensor");

        jMenuItemAddRemoveSensor.setText("Add/Remove Sensor");
        jMenuItemAddRemoveSensor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuItemAddRemoveSensorMouseClicked(evt);
            }
        });
        jMenuItemAddRemoveSensor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAddRemoveSensorActionPerformed(evt);
            }
        });
        jMenuSensor.add(jMenuItemAddRemoveSensor);

        jMenuBarTop.add(jMenuSensor);

        setJMenuBar(jMenuBarTop);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jToolBarDefaultToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, 613, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(jPanelMainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 623, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBarDefaultToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanelMainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItemCloseRecordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCloseRecordActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jMenuItemCloseRecordActionPerformed

    private void jMenuItemNewRecordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNewRecordActionPerformed
        AddNewUserPop addUser = new AddNewUserPop();
        addUser.setTitle("Add New Patient");
        addUser.setVisible(true);
        addUser.setLocation(300, 150);
        addUser.setSize(540, 350);
        throw new UnsupportedOperationException("Not supported yet");
    }//GEN-LAST:event_jMenuItemNewRecordActionPerformed

    private void jButtonDiscardSessionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDiscardSessionActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jButtonDiscardSessionActionPerformed

    private void jButtonSaveSessionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveSessionActionPerformed
        ClassDB.readFile("C:\\Users\\shahsant\\Documents\\NetBeansProjects\\RehabApplication\\data.txt");
        throw new UnsupportedOperationException("read file to database Exception");
    }//GEN-LAST:event_jButtonSaveSessionActionPerformed

    private void jMenuItemViewSavedDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemViewSavedDataActionPerformed
        ClassDB.retriveData();
        throw new UnsupportedOperationException("Not supported yet.");
    }//GEN-LAST:event_jMenuItemViewSavedDataActionPerformed

    private void jPanelAccGraphComponentAdded(java.awt.event.ContainerEvent evt) {//GEN-FIRST:event_jPanelAccGraphComponentAdded
//        panel graphPanel = new panel();
//        jPanelGraph.add(graphPanel);
}//GEN-LAST:event_jPanelAccGraphComponentAdded

    private void jRadioButton2GActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2GActionPerformed
        //accListener.doSetScale(2);
}//GEN-LAST:event_jRadioButton2GActionPerformed

    private void jRadioButton6GActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton6GActionPerformed
        //accListener.doSetScale(6);
    }//GEN-LAST:event_jRadioButton6GActionPerformed

    private void jLabelConnectionPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jLabelConnectionPropertyChange
        /*if (jLabelConnection.getText().startsWith("connected") && !fixedData) {
            if (accListener.is2GScale()) {
                jRadioButton2G.setSelected(true);
            } else {
                jRadioButton6G.setSelected(true);
            }
        }*/

    }//GEN-LAST:event_jLabelConnectionPropertyChange

    private void jButtonStartLoggingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonStartLoggingActionPerformed
        sendData = !sendData;
        jButtonStartLogging.setText(sendData ? "Stop Data" : "Start Logging");
        clearedData = false;
    }//GEN-LAST:event_jButtonStartLoggingActionPerformed

    private void jButtonRetrieveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRetrieveActionPerformed
        Vector Colname = new Vector();
        Vector list = new Vector();
        Colname.add(new String("x"));
        Colname.add(new String("y"));
        Colname.add(new String("z"));
        Colname.add(new String("g"));
        Colname.add(new String("Time"));
        rs = ClassDB.retriveData();
        try {
            int count = 0;
            while (rs.next()) {

                Double x = new Double(rs.getDouble("x"));
                Double y = new Double(rs.getDouble("y"));
                Double z = new Double(rs.getDouble("z"));
                Double g = new Double(rs.getDouble("g"));
                Integer indx = new Integer(rs.getInt("indx"));
                Vector result = new Vector();
                result.add(x);
                result.add(y);
                result.add(z);
                result.add(g);
                result.add(indx);
                list.add(result);
//                graphView2.takeData(rs.getString("id"), rs.getLong("tMS"), rs.getInt("indx"), rs.getDouble("x"), rs.getDouble("y"), rs.getDouble("z"), rs.getDouble("g"), rs.getBoolean("twoG"));
                //System.out.println(Double.toString(rs.getDouble("x"))+Double.toString(rs.getDouble("y"))+Double.toString(rs.getDouble("z")));
                count++;
            }

            jTable1.setModel(new DefaultTableModel(list, Colname) {

                Class[] types = new Class[]{
                    java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Long.class
                };
                boolean[] canEdit = new boolean[]{
                    false, false, false, false, false
                };

                public Class getColumnClass(int columnIndex) {
                    return types[columnIndex];
                }

                public boolean isCellEditable(int rowIndex, int columnIndex) {
                    return canEdit[columnIndex];
                }
            });
            jScrollPane1.setViewportView(jTable1);
            jTable1.setVisible(true);

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("printing to text field " + e.getMessage());
        } finally {
            ClassDB.closeConnection();
        }
}//GEN-LAST:event_jButtonRetrieveActionPerformed

    private void graphViewScrollPaneMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_graphViewScrollPaneMouseClicked
        System.out.println("X = " + Integer.toString(evt.getX()) + "Y = " + Integer.toString(evt.getY()));
}//GEN-LAST:event_graphViewScrollPaneMouseClicked

    private void jLayeredPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLayeredPane1MouseClicked
        // When mouse is clicked, draw straight line
        System.out.println("X = " + Integer.toString(evt.getX()) + "Y = " + Integer.toString(evt.getY()));
    }//GEN-LAST:event_jLayeredPane1MouseClicked

    private void jMenuItemAddRemoveSensorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItemAddRemoveSensorMouseClicked
    }//GEN-LAST:event_jMenuItemAddRemoveSensorMouseClicked

    private void jMenuItemAddRemoveSensorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAddRemoveSensorActionPerformed
        SensorDrop.createAndShowGUI();
    //        AddRemoveSensor addRemoveSensor = new AddRemoveSensor();
//        addRemoveSensor.setVisible(true);
//        addRemoveSensor.setLocation(400, 150);
    //setDefaultCloseOperation();
    }//GEN-LAST:event_jMenuItemAddRemoveSensorActionPerformed

    private void jLayeredPane1MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLayeredPane1MouseDragged
        // TODO add your handling code here:
    }//GEN-LAST:event_jLayeredPane1MouseDragged

    private void jMenuItemChangeUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemChangeUserActionPerformed
   
    }//GEN-LAST:event_jMenuItemChangeUserActionPerformed

    private void jMenuItemExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemExitActionPerformed
        this.dispose();
    }//GEN-LAST:event_jMenuItemExitActionPerformed

    private void jButtonLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLoginActionPerformed
        String username = null;
        char[] password = null;
        
        username = jTextFieldLogin.getText();
        password = jPasswordFieldPassword.getPassword();
        verifyUser(username, password);

        if(UserVerfied){
            jButtonNewTherapist.setEnabled(admin);
            setMainDisplayPanel(jPanelTaskSelector);
        }
}//GEN-LAST:event_jButtonLoginActionPerformed

    private void jButtonExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonExitActionPerformed
      this.dispose();
}//GEN-LAST:event_jButtonExitActionPerformed

    private void jTextFieldLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldLoginActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldLoginActionPerformed

    private void jButtonPatientSearchResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPatientSearchResetActionPerformed
        jTextFieldPatientSearchName.setText("");
        jTextFieldPatientSearchLast.setText("");
}//GEN-LAST:event_jButtonPatientSearchResetActionPerformed

    private void jButtonNewPatientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewPatientActionPerformed
        setMainDisplayPanel(jPanelAddNewPatient1);
}//GEN-LAST:event_jButtonNewPatientActionPerformed

    private void jButtonExit1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonExit1ActionPerformed
        setMainDisplayPanel(jPanelLoginPanel);
        UserVerfied = false;
        jLabelLoginStatus.setText("Logged Off, Thank you");
        jTextFieldLogin.setText("");
        jPasswordFieldPassword.setText("");
        admin = false;
    }//GEN-LAST:event_jButtonExit1ActionPerformed

    private void jButtonSearchPatientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSearchPatientActionPerformed
        setMainDisplayPanel(jPanelPatientSearch);
}//GEN-LAST:event_jButtonSearchPatientActionPerformed

    private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed
        int pID = Integer.parseInt(jTextFieldPatientId.getText());
        String name = jTextFieldFirstName.getText();
        String last = jTextFieldLastName.getText();
        String gender = (String) jComboBoxGender.getSelectedItem();
        int age = Integer.parseInt(jTextFieldAge.getText());
        String address = jTextFieldAddress.getText();
        String city = jTextFieldCity.getText();
        String state = jTextFieldState.getText();

        //       ClassDB.openConnection(name, pID);
        ClassDB.addNewPatient(pID, name, last, gender, age, address, city, state);
    //       ClassDB.closeConnection();
}//GEN-LAST:event_jButtonAddActionPerformed

    private void jButtonResetTherapistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonResetTherapistActionPerformed
        jTextFieldFirstName.setText("");
        jTextFieldPatientId.setText("");
}//GEN-LAST:event_jButtonResetTherapistActionPerformed

    private void jButtonExitTherapistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonExitTherapistActionPerformed
        setMainDisplayPanel(jPanelTaskSelector);
}//GEN-LAST:event_jButtonExitTherapistActionPerformed

    private void jComboBoxGenderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxGenderActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jComboBoxGenderActionPerformed

    private void jTextFieldAgeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldAgeActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldAgeActionPerformed

    private void jTextFieldLastNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldLastNameActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldLastNameActionPerformed

    private void jButtonAddPatientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddPatientActionPerformed

        int pID = Integer.parseInt(jTextFieldPatientId1.getText());
        String name = jTextFieldFirstName1.getText();
        String last = jTextFieldLastName1.getText();
        String gender = (String) jComboBoxGender1.getSelectedItem();
        int age = Integer.parseInt(jTextFieldAge1.getText());
        String address = jTextFieldAddress1.getText();
        String city = jTextFieldCity1.getText();
        String state = jTextFieldState1.getText();

        System.out.println(pID + name + last + gender + age + address + city + state);

        ClassDB.addNewPatient(pID, name, last, gender, age, address, city, state);
   
}//GEN-LAST:event_jButtonAddPatientActionPerformed

    private void jButtonResetPatientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonResetPatientActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jButtonResetPatientActionPerformed

    private void jButtonGoBackPatientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGoBackPatientActionPerformed
        setMainDisplayPanel(jPanelTaskSelector);
}//GEN-LAST:event_jButtonGoBackPatientActionPerformed

    private void jComboBoxGender1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxGender1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBoxGender1ActionPerformed

    private void jTextFieldAge1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldAge1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldAge1ActionPerformed

    private void jTextFieldLastName1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldLastName1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldLastName1ActionPerformed

    private void jButtonNewTherapistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewTherapistActionPerformed
        setMainDisplayPanel(jPanelAddNewTherapist);
    }//GEN-LAST:event_jButtonNewTherapistActionPerformed

    private void jButtonPatientSearchGoBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPatientSearchGoBackActionPerformed
        setMainDisplayPanel(jPanelTaskSelector);
}//GEN-LAST:event_jButtonPatientSearchGoBackActionPerformed

    private void jButtonPatientSearchSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPatientSearchSearchActionPerformed
        //if (jTextFieldPatientSearchName.getText().contentEquals("John")) {
        rset = ClassDB.searchPatients(jTextFieldPatientSearchName.getText(), jTextFieldPatientSearchLast.getText());
        System.out.println("Back to main frame");
         try {
             rset.last();                       // find out if there are more than 1 entries
             int numRows = rset.getRow();
             System.out.println("number of rows in resultset = " +numRows);
             if(numRows>1){                     // create radio buttons to select all found patients
                 System.out.println("More than 1 patient found");
                 rset.first();
                 System.out.println("row set to : "+rset.getRow());
                 jPanelMultiplePatients.removeAll();
                 for(int i = 0; i<numRows; i++){
                     String radioName = "Name: "+rset.getString("pName")+"\t\t\t Last: "+rset.getString("pLast")+"\t\t\t ID: "+rset.getString("pID");
                     patientResult[rset.getRow()] = new JRadioButton(radioName);
                     patientResult[rset.getRow()].setActionCommand(Integer.toString(rset.getRow()));
                     bGroup.add(patientResult[rset.getRow()]);
                     jPanelMultiplePatients.setLayout(new GridLayout(0, 1));
                     jPanelMultiplePatients.add(patientResult[rset.getRow()]);
                     rset.next();
                 }
                 jPanel11.removeAll();
                 jPanel11.add(jPanelMultiplePatients);
                 setMainDisplayPanel(jPanelMultiplePatientFound);

//                 int selectedButton = Integer.parseInt(bGroup.getSelection().getActionCommand());
//                 System.out.println(selectedButton);
             }
             else if (numRows == 1) {
                 System.out.println("1 patient found");
                 setPatientFoundDetails(0);
             } else {
                    System.out.println("No such entries found");
                    jLabelPatientSearchStatus.setText("Sorry no such entry found");
            }
         }catch (SQLException e) {
                System.out.println("Patient Search extration exception " + e.getMessage());
                e.printStackTrace();
//            }
        }

}//GEN-LAST:event_jButtonPatientSearchSearchActionPerformed

    private void setPatientFoundDetails(int rowNum){
        try{
            if (rowNum == 0) {
                rset.first();
            } else {
                rset.absolute(rowNum);
            }

            jTextFieldPatientSearchResultPatientID.setText(rset.getString("pID"));
            jTextFieldPatientSearchResultPatientID.setEnabled(false);
            jTextFieldPatientSearchResultPatientName.setText(rset.getString("pName"));
            jTextFieldPatientSearchResultPatientName.setEnabled(false);
            jTextFieldPatientSearchResultPatientLast.setText(rset.getString("pLast"));
            jTextFieldPatientSearchResultPatientLast.setEnabled(false);
            jTextFieldPatientSearchResultPatientAge.setText(rset.getString("pAge"));
            jTextFieldPatientSearchResultPatientAge.setEnabled(false);
            jTextFieldPatientSearchResultPatientAddress.setText(rset.getString("pAddress"));
            jTextFieldPatientSearchResultPatientAddress.setEnabled(false);
            jTextFieldPatientSearchResultPatientCity.setText(rset.getString("pCity"));
            jTextFieldPatientSearchResultPatientCity.setEnabled(false);
            jTextFieldPatientSearchResultPatientState.setText(rset.getString("pState"));
            jTextFieldPatientSearchResultPatientState.setEnabled(false);
        }
        catch (SQLException ex){
            System.out.println("Reading rset Exception"+ex.getMessage());
            ex.printStackTrace();
        }
        setMainDisplayPanel(jPanelPatientSearchResult);

}



    private void jButtonPatientSearchResultViewHistoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPatientSearchResultViewHistoryActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jButtonPatientSearchResultViewHistoryActionPerformed

    private void jButtonPatientSearchResultStartNewSessionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPatientSearchResultStartNewSessionActionPerformed
        displayFoundSpots();
}//GEN-LAST:event_jButtonPatientSearchResultStartNewSessionActionPerformed

    private void jButtonPatientSearchResultGoBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPatientSearchResultGoBackActionPerformed
        setMainDisplayPanel(jPanelPatientSearch);
}//GEN-LAST:event_jButtonPatientSearchResultGoBackActionPerformed

    private void jComboBoxPatientSearchResultGenderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxPatientSearchResultGenderActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jComboBoxPatientSearchResultGenderActionPerformed

    private void jTextFieldPatientSearchResultPatientNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPatientSearchResultPatientNameActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldPatientSearchResultPatientNameActionPerformed

    private void jTextFieldPatientSearchResultPatientLastActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPatientSearchResultPatientLastActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldPatientSearchResultPatientLastActionPerformed

    private void jTextFieldPatientSearchResultPatientAgeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPatientSearchResultPatientAgeActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldPatientSearchResultPatientAgeActionPerformed

    private void jTextFieldPatientSearchResultPatientAddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPatientSearchResultPatientAddressActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldPatientSearchResultPatientAddressActionPerformed

    private void jTextFieldPatientSearchResultPatientCityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPatientSearchResultPatientCityActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldPatientSearchResultPatientCityActionPerformed

    private void jTextFieldPatientSearchResultPatientStateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPatientSearchResultPatientStateActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldPatientSearchResultPatientStateActionPerformed

    private void jButtonNewSessionGoBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewSessionGoBackActionPerformed
        setMainDisplayPanel(jPanelPatientSearchResult);
}//GEN-LAST:event_jButtonNewSessionGoBackActionPerformed

    private void jButtonNewSessionConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewSessionConfigureActionPerformed
        if (checkSPOTBoxSelection()) {
            prepareMainGraphSubPanel();
            displaySensorDnD(currentSPOT);
        }
}//GEN-LAST:event_jButtonNewSessionConfigureActionPerformed

    private void jButtonConfigureSensorConfigureSpotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfigureSensorConfigureSpotActionPerformed
        waitForSpotSensorConfig(currentSPOT);//GEN-HEADEREND:event_jButtonConfigureSensorConfigureSpotActionPerformed
}//GEN-LAST:event_jButtonConfigureSensorConfigureSpotActionPerformed

    private void jButtonConfigureSensorGoBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfigureSensorGoBackActionPerformed
        setMainDisplayPanel(jPanelNewSession);
        currentSPOT = 0;
}//GEN-LAST:event_jButtonConfigureSensorGoBackActionPerformed

    private void jButtonConfigureSensorStatusUpdateConfigureSpotNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfigureSensorStatusUpdateConfigureSpotNextActionPerformed
        displaySensorConfigProgress();
        Listener myListener = ((SingleSPOT) SPOTLIST.get(currentSPOT)).getListener();
        //System.out.println(spotReturnType[currentSPOT].elementAt(0));
        //System.out.println(spotReturnType[currentSPOT].elementAt(1));
        //System.out.println(spotReturnType[currentSPOT].elementAt(2));
        System.out.println(" MainFrame: CurrentSPOT " + currentSPOT);
        myListener.addSensors(spotReturnType[currentSPOT]);
        myListener.finishConfig();
        

}//GEN-LAST:event_jButtonConfigureSensorStatusUpdateConfigureSpotNextActionPerformed

    private void jButtonConfigureSensorStatusUpdateGoBack1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfigureSensorStatusUpdateGoBack1ActionPerformed
        // TODO add your handling code here:
        setMainDisplayPanel(jPanelConfigureSensor);

}//GEN-LAST:event_jButtonConfigureSensorStatusUpdateGoBack1ActionPerformed

    private void jButtonResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonResetActionPerformed
       jTextFieldLogin.setText("");
       jPasswordFieldPassword.setText("");
       jLabelLoginStatus.setText("");
    }//GEN-LAST:event_jButtonResetActionPerformed

    private void jPanelMultiplePatientFoundSelectPatientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPanelMultiplePatientFoundSelectPatientActionPerformed
        int selectedButton = Integer.parseInt(bGroup.getSelection().getActionCommand());
        setPatientFoundDetails(selectedButton);
        System.out.println(selectedButton);
}//GEN-LAST:event_jPanelMultiplePatientFoundSelectPatientActionPerformed

    private void jButtonlMultiplePatientFoundBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonlMultiplePatientFoundBackActionPerformed
       setMainDisplayPanel(jPanelPatientSearch);
}//GEN-LAST:event_jButtonlMultiplePatientFoundBackActionPerformed

    public void canvesPanelMouseClicked(java.awt.event.MouseEvent evt, Integer sp, Integer sn) {
        int spot = sp.intValue();
        int sensor = sn.intValue();

        canvas[spot][sensor].setCord(evt.getX(), evt.getY());
        canvas[spot][sensor].repaint();
        System.out.println("X = " + Integer.toString(evt.getX()) + "Y = " + Integer.toString(evt.getY()));
    }

    private void canvesPane1MouseDragged(java.awt.event.MouseEvent evt, Integer sp, Integer sn) {
        int spot = sp.intValue();
        int sensor = sn.intValue();
        canvas[spot][sensor].setCord(0, 0, evt.getX());
    }

    private void sensorPanelPopUp(java.awt.event.MouseEvent evt,Integer sp, Integer sn){

        final Integer passSpot = sp;

        int spot = sp.intValue();
        int sensor = sn.intValue();
        JButton jButtonreturnToPreviousScreen = new JButton("Return to Previous Screen");

       jPanelMainGraphSubPanel.removeAll();
       graphPanelSPOT[spot].removeAll();
       graphPanelSPOT[spot].add(graphPanelSensors[spot][sensor]);
       jPanelMainGraphSubPanel.add(graphPanelSPOT[spot]);
       jPanelMainGraphSubPanel.add(jButtonreturnToPreviousScreen);
//       graphPanelSPOT[spot].validate();
//       graphPanelSPOT[spot].repaint();
       jPanelMainGraphSubPanel.validate();
       jPanelMainGraphSubPanel.repaint();

       jButtonreturnToPreviousScreen.addMouseListener(new java.awt.event.MouseAdapter() {

           public void mouseClicked(java.awt.event.MouseEvent evt){
               
                   returnToPreviousScreen();
           }

       });
    }

    private void returnToPreviousScreen(){
        int sensor;
        jPanelMainGraphSubPanel.removeAll();

        for (int j = 0; j<numberOfSpots; j++){
            System.out.print(j);
            if (isSelected[j]) {
                System.out.println(isSelected[j]);
                graphPanelSPOT[j].removeAll();
                for (int i = 0; i < spotReturnType[j].size(); i++) {
                    sensor = ((Byte) spotReturnType[j].get(i)).intValue();
                    System.out.println("[" + j + "]" + "[" + sensor + "]");
                    graphPanelSPOT[j].add(graphPanelSensors[j][sensor]);
                }
                System.out.println("Reached end of spot "+(j+1));
                jPanelMainGraphSubPanel.add(graphPanelSPOT[j]);
                jPanelMainGraphSubPanel.revalidate();
            }
        }
        validate();
        repaint();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JScrollPane graphViewScrollPane;
    private javax.swing.JButton jButtonAdd;
    private javax.swing.JButton jButtonAddPatient;
    private javax.swing.JButton jButtonConfigureSensorConfigureSpot;
    private javax.swing.JButton jButtonConfigureSensorGoBack;
    private javax.swing.JButton jButtonConfigureSensorStatusUpdateConfigureSpotNext;
    private javax.swing.JButton jButtonConfigureSensorStatusUpdateGoBack1;
    private javax.swing.JButton jButtonDiscardSession;
    private javax.swing.JButton jButtonExit;
    private javax.swing.JButton jButtonExit1;
    private javax.swing.JButton jButtonExitTherapist;
    private javax.swing.JButton jButtonGoBackPatient;
    private javax.swing.JButton jButtonLogin;
    private javax.swing.JButton jButtonNewPatient;
    private javax.swing.JButton jButtonNewSessionConfigure;
    private javax.swing.JButton jButtonNewSessionGoBack;
    private javax.swing.JButton jButtonNewTherapist;
    private javax.swing.JButton jButtonPatientSearchGoBack;
    private javax.swing.JButton jButtonPatientSearchReset;
    private javax.swing.JButton jButtonPatientSearchResultGoBack;
    private javax.swing.JButton jButtonPatientSearchResultStartNewSession;
    private javax.swing.JButton jButtonPatientSearchResultViewHistory;
    private javax.swing.JButton jButtonPatientSearchSearch;
    private javax.swing.JButton jButtonReset;
    private javax.swing.JButton jButtonResetPatient;
    private javax.swing.JButton jButtonResetTherapist;
    private javax.swing.JButton jButtonRetrieve;
    private javax.swing.JButton jButtonSaveSession;
    private javax.swing.JButton jButtonSearchPatient;
    private javax.swing.JButton jButtonSettings;
    private javax.swing.JButton jButtonStartLogging;
    private javax.swing.JButton jButtonlMultiplePatientFoundBack;
    private javax.swing.JComboBox jComboBoxGender;
    private javax.swing.JComboBox jComboBoxGender1;
    private javax.swing.JComboBox jComboBoxPatientSearchResultGender;
    private javax.swing.JLabel jLabePatientSearchResultlAge;
    private javax.swing.JLabel jLabePatientSearchResultlLastName;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabelAddress;
    private javax.swing.JLabel jLabelAddress1;
    private javax.swing.JLabel jLabelAge;
    private javax.swing.JLabel jLabelAge1;
    private javax.swing.JLabel jLabelCity;
    private javax.swing.JLabel jLabelCity2;
    private javax.swing.JLabel jLabelCity3;
    private javax.swing.JLabel jLabelConfigureSensorStatus;
    private javax.swing.JLabel jLabelConfigureSensorStatusUpdate;
    private javax.swing.JLabel jLabelConnection;
    private javax.swing.JLabel jLabelConnectionStatus;
    private javax.swing.JLabel jLabelGender;
    private javax.swing.JLabel jLabelGender1;
    private javax.swing.JLabel jLabelGender2;
    private javax.swing.JLabel jLabelLastName;
    private javax.swing.JLabel jLabelLastName1;
    private javax.swing.JLabel jLabelLogin;
    private javax.swing.JLabel jLabelLoginStatus;
    private javax.swing.JLabel jLabelName;
    private javax.swing.JLabel jLabelName1;
    private javax.swing.JLabel jLabelName2;
    private javax.swing.JLabel jLabelNewSessionStatus;
    private javax.swing.JLabel jLabelPassword;
    private javax.swing.JLabel jLabelPatientId1;
    private javax.swing.JLabel jLabelPatientId2;
    private javax.swing.JLabel jLabelPatientSearchLast;
    private javax.swing.JLabel jLabelPatientSearchName;
    private javax.swing.JLabel jLabelPatientSearchResultAddress;
    private javax.swing.JLabel jLabelPatientSearchResultCity;
    private javax.swing.JLabel jLabelPatientSearchStatus;
    private javax.swing.JLabel jLabelState;
    private javax.swing.JLabel jLabelTherapistSSN;
    private javax.swing.JLabel jLabelTherapisttId;
    private javax.swing.JLabel jLabellPatientSearchResultCity;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JMenuBar jMenuBarTop;
    private javax.swing.JMenu jMenuData;
    private javax.swing.JMenu jMenuEdit;
    private javax.swing.JMenu jMenuFile;
    private javax.swing.JMenuItem jMenuItemAddRemoveSensor;
    private javax.swing.JMenuItem jMenuItemChangeUser;
    private javax.swing.JMenuItem jMenuItemCloseRecord;
    private javax.swing.JMenuItem jMenuItemCopy;
    private javax.swing.JMenuItem jMenuItemCut;
    private javax.swing.JMenuItem jMenuItemExit;
    private javax.swing.JMenuItem jMenuItemNewRecord;
    private javax.swing.JMenuItem jMenuItemNewTherapist;
    private javax.swing.JMenuItem jMenuItemOpenPatientRecord;
    private javax.swing.JMenuItem jMenuItemPaste;
    private javax.swing.JMenuItem jMenuItemSave;
    private javax.swing.JMenuItem jMenuItemSaveAs;
    private javax.swing.JMenuItem jMenuItemSaveSession;
    private javax.swing.JMenuItem jMenuItemViewSavedData;
    private javax.swing.JMenu jMenuSensor;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    public javax.swing.JPanel jPanelAccGraph;
    private javax.swing.JPanel jPanelAddNewPatient1;
    private javax.swing.JPanel jPanelAddNewTherapist;
    private javax.swing.JPanel jPanelConfigureSensor;
    private javax.swing.JPanel jPanelConfigureSensorStatusUpdate;
    private javax.swing.JPanel jPanelDeviceDiscovered;
    private javax.swing.JLabel jPanelDeviceDiscoveredWarning;
    private javax.swing.JPanel jPanelDnD;
    private javax.swing.JPanel jPanelLoginPanel;
    private javax.swing.JPanel jPanelMainGraphPanel;
    private javax.swing.JPanel jPanelMainGraphSubPanel;
    private javax.swing.JPanel jPanelMainPanel;
    private javax.swing.JPanel jPanelMultiplePatientFound;
    private javax.swing.JButton jPanelMultiplePatientFoundSelectPatient;
    private javax.swing.JPanel jPanelMultiplePatients;
    private javax.swing.JPanel jPanelNewSession;
    private javax.swing.JPanel jPanelPatientSearch;
    private javax.swing.JPanel jPanelPatientSearchResult;
    private javax.swing.JPanel jPanelTaskSelector;
    private javax.swing.JPasswordField jPasswordFieldPassword;
    private javax.swing.JProgressBar jProgressBarSensorStatusUpdate;
    private javax.swing.JProgressBar jProgressBarSpotsDiscovered;
    private javax.swing.JRadioButton jRadioButton2G;
    private javax.swing.JRadioButton jRadioButton6G;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jTextFieldAddress;
    private javax.swing.JTextField jTextFieldAddress1;
    private javax.swing.JTextField jTextFieldAge;
    private javax.swing.JTextField jTextFieldAge1;
    private javax.swing.JTextField jTextFieldCity;
    private javax.swing.JTextField jTextFieldCity1;
    private javax.swing.JTextField jTextFieldFirstName;
    private javax.swing.JTextField jTextFieldFirstName1;
    private javax.swing.JTextField jTextFieldLastName;
    private javax.swing.JTextField jTextFieldLastName1;
    private javax.swing.JTextField jTextFieldLogin;
    private javax.swing.JTextField jTextFieldPatientId;
    private javax.swing.JTextField jTextFieldPatientId1;
    private javax.swing.JTextField jTextFieldPatientSearchLast;
    private javax.swing.JTextField jTextFieldPatientSearchName;
    private javax.swing.JTextField jTextFieldPatientSearchResultPatientAddress;
    private javax.swing.JTextField jTextFieldPatientSearchResultPatientAge;
    private javax.swing.JTextField jTextFieldPatientSearchResultPatientCity;
    private javax.swing.JTextField jTextFieldPatientSearchResultPatientID;
    private javax.swing.JTextField jTextFieldPatientSearchResultPatientLast;
    private javax.swing.JTextField jTextFieldPatientSearchResultPatientName;
    private javax.swing.JTextField jTextFieldPatientSearchResultPatientState;
    private javax.swing.JTextField jTextFieldState;
    private javax.swing.JTextField jTextFieldState1;
    private javax.swing.JTextField jTextFieldTherapistSSN;
    private javax.swing.JToolBar jToolBarDefaultToolbar;
    private javax.swing.JPanel y_axisPanel;
    // End of variables declaration//GEN-END:variables
}
